class_name GameStats
extends Node2D

signal ship_experience_change
signal level_up

const BASE_LEVEL_UP_NEED_EXP = 2

var ship_level:int = 1:
	set(v):
		ship_level = v
		level_up.emit()
var ship_experience:int = 0:
	set(v):
		v = clamp(v, 0, level_up_need_exp)
		if ship_experience == v:
			return
		ship_experience = v
		ship_experience_change.emit()
		if ship_experience == level_up_need_exp:
			ship_level_up()
var level_up_need_exp: int = BASE_LEVEL_UP_NEED_EXP

##在此记录游戏过程中获得的buff和debuff
#攻击力数值加成
var attack_number_addition: float = 0.0
#伤害倍率
var attack_magnification: float = 1.0
#子弹发射数
var ammo_number: int = 1:
	set(v):
		v = clampi(v, 1, 5)
		ammo_number = v


func ship_level_up() -> void:
	print("level up + ", ship_experience)
	level_up_need_exp += ship_level * 10
	ship_level += 1
	ship_experience = 0
